package com.booth.base.model;

import java.util.List;

import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Model;
import com.jfinal.plugin.activerecord.Page;
/***
 * 用户组
 * @TypeName：Groups
 * @description：
 * @author：Administrator
 */
public class Groups extends Model<Groups>
{
	private static final long	serialVersionUID	= 1L;
	public static final Groups	dao	= new Groups();
	/***
	 * 获取组数据，并分页
	 * @param pageNumber：当前页
	 * @param pageSize：每页条数
	 * @return
	 */
	public static Page<Groups> paginate( int pageNumber, int pageSize )
	{
		return(dao.paginate( pageNumber, pageSize, "select *", "from Groups order by id asc" ) );
	}
	/***
	 * 删除组
	 * @param gid
	 * @return
	 */
	public boolean deleteGroup( Integer gid )
	{
		return(true);
	}
	/***
	 * 获取状态为可用的组
	 * @return
	 */
	public static List<Groups> showEnableGroups()
	{
		return(dao.find( "SELECT id,group_name FROM groups WHERE status=9" ) );
	}
	
	public List<Groups> checkGroup(int groupType){
		return dao.find("select * from groups where status = 9 and group_type = " + groupType);
	}
}